﻿using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System.Threading.Tasks;
using VisionCloud.Domain.Common;
using VisionCloud.Domain.DtoModel.Ms;
using VisionCloud.Domain.Filters;
using VisionCloud.Service.Ms;

namespace VisionCloud.Api.Controllers.Ms
{
    /// <summary>
    /// 点云数据相关
    /// </summary>
    [SystemModule("点云数据相关")]
    [ApiAuthorize(PolicyEnum.RequireRolePermission)]
    [ApiVersion("1.0")]
    [Route("api/ms/[controller]/[Action]")]
    [ApiExplorerSettings(GroupName = "点云数据相关")]
    public class DotCloudController : ApiBaseController
    {
        public MsTaskDotCloudService msTaskDotCloudService { get; set; }

        /// <summary>
        /// 点云数据上传
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost, SwaggerOperation(Tags = new[] { "上传" })]
        public async Task<ApiResult> Upload(DotCloudUploadRequestModel model)
        {
            return await TryCatchAsync(msTaskDotCloudService.AddOrUpdateDotCloud(model));
        }

        /// <summary>
        /// 点云上传的批次
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost, SwaggerOperation(Tags = new[] { "上传" })]
        public async Task<ApiResult> AddBatch(DotCloudUploadBatchDto model)
        {
            return await TryCatchAsync(msTaskDotCloudService.AddBatch(model));
        }
    }
}